//
//  ViewController.swift
//  basketball
//
//  Created by stu on 2019/9/18.
//  Copyright © 2019年 zoushenquan. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var first_team: UILabel!
    @IBOutlet weak var two_team: UILabel!
    var sum1: Int = 0
    var sum2: Int = 0
    
    @IBAction func first_three(_ sender: Any) {
        sum1 += 3
        first_team.text = "\(sum1)分"
    }
    @IBAction func first_two(_ sender: Any) {
        sum1 += 2                                                                                                                                           
        first_team.text = "\(sum1)分"
    }
    @IBAction func first_one(_ sender: Any) {
        sum1 += 1
        first_team.text = "\(sum1)分"
    }
    @IBAction func two_three(_ sender: Any) {
        sum2 += 3
        two_team.text = "\(sum2)分"
    }
    @IBAction func two_two(_ sender: Any) {
        sum2 += 2
        two_team.text = "\(sum2)分"
    }
    @IBAction func two_one(_ sender: Any) {
        sum2 += 1
        two_team.text = "\(sum2)分"
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func none(_ sender: Any) {
        let alert = UIAlertController(title: "提示",message: "是否重置分数?",preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: "取消", style: .cancel, handler: nil))
        alert.addAction(UIAlertAction(title: "确定", style: .default, handler: {
            action in
            self.first_team.text = "0分"
            self.two_team.text = "0分"
        }))
        self.present(alert, animated: true, completion: nil)
    }

}

